package com.xiaochong.tir.manager.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xiaochong.tir.manager.config.druid.Operation;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.xiaochong.tir.common.data.po.ExchangeTransactionpairMiddle;
import com.xiaochong.tir.common.data.mapper.ExchangeTransactionpairMiddleMapper;
import org.springframework.transaction.annotation.Transactional;

/**
 * 此类为[基础代码]自动生成,已经拥有基本的增删改成操作 
 * <其他请自行扩展>
 * @author cx
 * @time 2018-05-30 19:57
 * 
 */
@Service
public class ExchangeTransactionpairMiddleService{
 
      
    @Autowired
	private ExchangeTransactionpairMiddleMapper exchangeTransactionpairMiddleDao;
	
	
	/**
     * 新增
     * @param entity 
     * @param session
     */
	@Operation
    @Transactional
    public int insertSelective (ExchangeTransactionpairMiddle entity) { 
     return this.exchangeTransactionpairMiddleDao.insertSelective(entity);
    }	
    
    /**
     * 批量新增
     * @param list 
     * @param session
     */
    public void insertBatch(List<ExchangeTransactionpairMiddle> list) {
           
          this.exchangeTransactionpairMiddleDao.insertBatch(list);
         
         
    }
    
    /**
     * 根据主键修改单条数据
     * @param entity 
     * @param session
     */
    @Operation
    @Transactional
    public int updateByPrimaryKey(ExchangeTransactionpairMiddle entity,ExchangeTransactionpairMiddle old) {
           return this.exchangeTransactionpairMiddleDao.updateByPrimaryKey(entity);
    }
    
    /**
     * 根据主键批量修改数据
     * @param list 
     * @param session
     */
    public void updateBatch(List<ExchangeTransactionpairMiddle> list) {
           
          this.exchangeTransactionpairMiddleDao.updateBatch(list);
          
        
    }
    
    /**
     * 根据主键查询单条数据
     * @param id
     */
    public ExchangeTransactionpairMiddle selectByPrimaryKey(Integer id) {
            return this.exchangeTransactionpairMiddleDao.selectByPrimaryKey(id);
    }
    
    /**
     * 根据条件查询单条记录
     * @param entity 
     */
    public ExchangeTransactionpairMiddle selectByEntity(ExchangeTransactionpairMiddle entity) {
           return this.exchangeTransactionpairMiddleDao.selectByEntity(entity);
    }
    
    
    /**
     * 根据条件查询多条记录
     * @param entity 
     */
    public List<ExchangeTransactionpairMiddle> selectByEntityList(ExchangeTransactionpairMiddle entity) {
           return  this.exchangeTransactionpairMiddleDao.selectByEntityList(entity);
    }
    
    /**
     * 根据条件查询Id
     * @param entity 
     */
    public Integer selectById(ExchangeTransactionpairMiddle entity) {
           return  this.exchangeTransactionpairMiddleDao.selectById(entity);
    }
    
     /**
     * 根据条件查询Ids
     * @param entity 
     */
    public List<Integer> selectByIds(ExchangeTransactionpairMiddle entity) {
        return  this.exchangeTransactionpairMiddleDao.selectByIds(entity);
    }
    
     /**
     * 根据主键删除单条记录
     * @param id
     */
     @Operation
     @Transactional
    public void deleteByPrimaryKey(Integer id,ExchangeTransactionpairMiddle old) {
           this.exchangeTransactionpairMiddleDao.deleteByPrimaryKey(id);
    }

    @Transactional
    public void deleteByPrimaryKeys(Integer id) {
        this.exchangeTransactionpairMiddleDao.deleteByPrimaryKey(id);
    }
    
    /**
     * 根据主键删除多条记录
     * @param list
     */
    public void deleteBatch(List<Integer> list) {
           this.exchangeTransactionpairMiddleDao.deleteBatch(list);
    }
    
     /**
     * 根据某些条件删除
     * @param entity
     */
    @Operation
    @Transactional
    public void deleteByTraId(Integer id,ExchangeTransactionpairMiddle entity) {
           this.exchangeTransactionpairMiddleDao.deleteByTraId(entity);
    }


    public PageInfo<ExchangeTransactionpairMiddle>
    selectByEntitys(ExchangeTransactionpairMiddle exchangeTransactionpairMiddle, Integer pageSize, Integer pageIndex) {
        PageHelper.startPage(pageIndex,pageSize);
        return new PageInfo<ExchangeTransactionpairMiddle>(
                this.exchangeTransactionpairMiddleDao.selectByEntitys(exchangeTransactionpairMiddle));
    }

    public int updateByName(ExchangeTransactionpairMiddle exchangeTransactionpairMiddle) {
       return this.exchangeTransactionpairMiddleDao.updateByName(exchangeTransactionpairMiddle);
    }

    public int updateByEtmId(Integer id) {
        return this.exchangeTransactionpairMiddleDao.updateByEtmId(id);
    }
}